package com.example.strategy;

/**
 * Created by Risky57 on 2017/4/28.
 */

public abstract class Duck {

    private String name;
    protected FlyBehavior mFlyBehavior;

    public Duck (String name) {
        this.name = name;
    }

    public void swimming(){
        System.out.println(name + "鸭子在游泳");
    }

    public final void fly(){
        mFlyBehavior.fly();
    }

    public void setFlyBehavior (FlyBehavior flyBehavior) {
        mFlyBehavior = flyBehavior;
    }

    public abstract void display();


}
